const path = require("path");
import { defineConfig, loadEnv } from "vite";
import vue from "@vitejs/plugin-vue";
import styleImport, { VantResolve } from "vite-plugin-style-import";
// https://vitejs.dev/config/
export default defineConfig(({ command, mode }) => {
    return {
        base: '/',
        resolve: {
            alias: {
                '@': path.resolve(__dirname, 'src') // 设置 `@` 指向 `src` 目录
            }
        },
        plugins: [
            vue(),
            styleImport({
                resolves: [VantResolve()],
            }),
        ],
        build: {
            terserOptions: {
                compress: {
                    drop_console: true,
                    drop_debugger: true
                }
            }
        },
        server: {
            open: true, // 浏览器自动打开
            proxy: {
                '/admin': loadEnv(mode, process.cwd()).VITE_APP_API // 'http://172.18.0.54:19999/'
            },
            cors: true
        }
    }
})